package cn.com.huzo.repository.trade.impl;

import cn.com.huzo.model.entities.trade.ProductionInstructionLinesDestinationEntity;
import huzofw.repository.impl.GenericRepositoryImpl;
import huzofw.repository.impl.MyBatisDaoUtils;
import java.util.List;
import org.springframework.stereotype.Repository;
import cn.com.huzo.repository.trade.ProductionInstructionLinesDestinationRepository;

/**
 * 生产指示书明细-发货目的地数据访问对象。
 *
 * @author 吴旭
 */
@Repository("ProductionInstructionLinesDestinationRepository")
public class ProductionInstructionLinesDestinationRepositoryImpl extends GenericRepositoryImpl<ProductionInstructionLinesDestinationEntity, String>
        implements ProductionInstructionLinesDestinationRepository {

    private final String namespace = "cn.com.huzo.repository.trade.ProductionInstructionLinesDestinationRepository";

    /**
     * 构造函数,设置the instance to ProductRepositoryImpl.class.
     */
    public ProductionInstructionLinesDestinationRepositoryImpl() {
        super(ProductionInstructionLinesDestinationEntity.class);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<ProductionInstructionLinesDestinationEntity> fetchProductionInstructionLinesDestinationNode(Long headerId) {
        return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchByHeaderId"), headerId);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String insert(ProductionInstructionLinesDestinationEntity instance) {
        getSqlSession().insert(MyBatisDaoUtils.getMapperQueryId(
                namespace, "insert"), instance);
        return instance.getLinesId();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer batchInsert(List<ProductionInstructionLinesDestinationEntity> itemList) {
        return getSqlSession().insert(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchInsert"), itemList);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer batchUpdate(List<ProductionInstructionLinesDestinationEntity> itemList) {
        return getSqlSession().update(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchUpdate"), itemList);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer delete(String linesId) {
        return getSqlSession().delete(MyBatisDaoUtils.getMapperQueryId(
                namespace, "delete"), linesId);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer updateDestinationOrder(List<ProductionInstructionLinesDestinationEntity> itemList) {
        return getSqlSession().update(MyBatisDaoUtils.getMapperQueryId(
                namespace, "updateDestinationOrder"), itemList);
    }
    
    /**
     * {@inheritDoc}
     */
    @Override
    public Integer deleteInvalidData(Long headerId) {
        return getSqlSession().delete(MyBatisDaoUtils.getMapperQueryId(
                namespace, "deleteInvalidData"), headerId);
    }
}
